package com.android.sha.tools;

import com.android.angle.AngleAbstractSprite;
import com.android.angle.AngleActivity;
import com.android.angle.AngleSpriteLayout;
import com.android.sha.common.MyCommon;

public class SpriteHelper {
	private AngleSpriteLayout layout;
	private AngleActivity mActivity;
	
	
	public SpriteHelper(AngleActivity mActivity){
		this.mActivity = mActivity;
	}
	public AngleSpriteLayout getPlayerLayout(int resouseId) {
		layout = new AngleSpriteLayout(mActivity.mGLSurfaceView,MyCommon.PLAYERWIDTH,MyCommon.PLAYERHEIGHT,resouseId);
		return layout;
	}
	public AngleSpriteLayout getCardLayout(int resouseId) {
		layout = new AngleSpriteLayout(mActivity.mGLSurfaceView,MyCommon.CARDWIDTH,MyCommon.CARDHEIGHT,resouseId);
		return layout;
	}
	public AngleSpriteLayout getBloodLayout(int resouseId) {
		layout = new AngleSpriteLayout(mActivity.mGLSurfaceView,MyCommon.PLAYERWIDTH/5,MyCommon.PLAYERHEIGHT/5,resouseId);
		return layout;
	}
	public boolean test(AngleAbstractSprite sprite,float x, float y,int width,int height)
	{
		float top=sprite.mPosition.mY - height/2;
		float left=sprite.mPosition.mX - width/2;
		if (x >= left)
			if (y >= top)
				if (x < left + width)
					if (y < top +height)
						return true;
		return false;
	}
	
}
